<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>菜单页面</title>
</head>
<div th:insert="/common/common"></div>
<style>
    .iframeClass{
        height: 800px !important;
        width: 1300px !important;
    }
</style>
<script>
    $(function(){
        $('#tree').treeview({
            data: getTree(),
            showCheckbox: true
        });

        $('#tree').on('nodeSelected',function(event, data) {
            if (data.url != null && data.url != ""){
                $.addtabs.add({
                    title : data.text,
                    url : data.url,
                    id : data.id
                })
            }

        });
    })

    function getTree(){
        var tree = [];
        $.ajax({
            url : "/menucontroller/getTree",
            type : "get",
            dataType : "json",
            async : false,
            success : function (list){
                tree = list;
            },
            error : function (list){
                toastr.error("网络错误");
            }
        })
        return tree;
    }
</script>
<body>
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-2">
                <div id="tree"></div>
            </div>
            <div class="col-md-10">
                <div class="tabbable">
                    <ul class="nav nav-tabs" id="myTab"></ul>
                    <div class="tab-content"></div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>